#!/bin/bash

pdfDebug=false
pdfDebugFile=./tmp/debug.tex
pdfDebugOutput=${pdfDebugFile/tex/pdf}

if [ $pdfDebug = true ]
then
    if [ -f $pdfDebugFile ]
    then
	pdflatex -output-directory tmp $pdfDebugFile
	if [ -f ${pdfDebugOutput} ]
	then
	    mv ${pdfDebugOutput} ${1/tex/pdf}
	fi
    fi
else
    pdflatex -output-directory tmp $1
fi
